package online.hxstar.learn.nio.bio2;

import java.util.concurrent.*;

/**
 * @author huxing
 * @date 2018-12-13 10:43
 * @describe
 */
class TimeServerHandlerExecutePool {

    private ExecutorService executorService;


    TimeServerHandlerExecutePool(int maxPoolSize, int queueSize) {
        ThreadFactory factory = new ThreadFactoryBuilder().setNamePrefix("时间线程").build();
        executorService = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), maxPoolSize, 120L, TimeUnit.SECONDS, new ArrayBlockingQueue<>(queueSize), factory);
    }

    void execute(Runnable task) {
        executorService.execute(task);
    }


}
